package com.chj;

import com.chj.collector.CustomizeCollector;
import io.prometheus.client.exporter.MetricsServlet;
import io.prometheus.client.hotspot.DefaultExports;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class CustomizeExporterApplication {
    public static void main(String[] args) {
        new CustomizeCollector().register();
//        DefaultExports.initialize();
        SpringApplication.run(CustomizeExporterApplication.class);
    }

    @Bean
    public ServletRegistrationBean heServletRegistrationBean(){
        ServletRegistrationBean registrationBean = new ServletRegistrationBean(new MetricsServlet(),"/metrics");
        return registrationBean;
    }
}
